package com.example.admin.controller;


import com.example.admin.model.TaskDisp;
import com.example.admin.result.ResponseResult;
import com.example.admin.service.SchedulerXService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/schedulerx")
public class SchedulerXContrller {

    @Autowired
    SchedulerXService schedulerXService;


    @RequestMapping(value = "/startSchedulerX", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseResult<String> startSchedulerX(@RequestBody TaskDisp taskDisp) {
        return schedulerXService.startSchedulerX(taskDisp);
    }

    @RequestMapping(value = "/stopSchedulerX", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseResult<String> stopSchedulerX(@RequestBody TaskDisp taskDisp) {
        return schedulerXService.stopSchedulerX(taskDisp);
    }

    @RequestMapping(value = "/updateSchedulerX", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseResult<String> updateSchedulerX(@RequestParam(required = false) TaskDisp taskDisp) {
        return schedulerXService.updateSchedulerX(taskDisp);
    }

    @RequestMapping(value = "/saveSchedulerX", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseResult<String> saveSchedulerX(@RequestParam(required = false) TaskDisp taskDisp) {
        return schedulerXService.saveSchedulerX(taskDisp);
    }

    @RequestMapping(value = "/deleteSchedulerX", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseResult<String> deleteSchedulerX(@RequestParam(required = false) TaskDisp taskDisp) {
        return schedulerXService.deleteSchedulerX(taskDisp);
    }

}
